using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace Slqj.Data
{
	public static class TableMemberType
	{
		public const string Table = "MemberType";
		public const string MemberTypeID = "MemberTypeID";
		public const string MemberTypeName = "MemberTypeName";
		public const string Description = "Description";
	}
	
	[Serializable]
	public class BaseMemberType
		: IDbSessionEntity, IJsonClass
	{
		int m_MemberTypeID;
		/// <summary>
        /// 会员类型表ID
        /// </summary>
        public int MemberTypeID
        {
            get { return m_MemberTypeID; }
            set { m_MemberTypeID = value; }
        }
		
		string m_MemberTypeName;
		/// <summary>
        /// 会员类型名称
        /// </summary>
        public string MemberTypeName
        {
            get { return m_MemberTypeName; }
            set { m_MemberTypeName = value; }
        }
		
		string m_Description;
		/// <summary>
        /// 会员类型描述
        /// </summary>
        public string Description
        {
            get { return m_Description; }
            set { m_Description = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_MemberTypeID = reader[TableMemberType.MemberTypeID];
            m_MemberTypeName = reader[TableMemberType.MemberTypeName];
            m_Description = reader[TableMemberType.Description];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableMemberType.MemberTypeID, PrimaryKeyType.Identity, MemberTypeID);
			writer[TableMemberType.MemberTypeName] = MemberTypeName;
			writer[TableMemberType.Description] = Description;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_MemberTypeID = idd;
        }
		
		public string TableName
        {
            get { return TableMemberType.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_MemberTypeID = hashToRead["MemberTypeID"];
			 
             m_MemberTypeName = hashToRead["MemberTypeName"];
			 
             m_Description = hashToRead["Description"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["MemberTypeID"] = MemberTypeID;
			 
            hashToFill["MemberTypeName"] = MemberTypeName;
			 
            hashToFill["Description"] = Description;
			 
        }

        #endregion
		
	}
}
